package com.westa.smallshop.data;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * Created by dune on 15/12/23.
 */
public class User implements Parcelable {

    private long id;
    private String username;
    private String account;
    private String password;
    private List<String> goods_list;
    private String portrait;

    public User(long id, String username, String account, String password, List<String> goods_list, String portrait) {
        this.id = id;
        this.username = username;
        this.account = account;
        this.password = password;
        this.goods_list = goods_list;
        this.portrait = portrait;
    }

    public User() {
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<String> getGoods_list() {
        return goods_list;
    }

    public void setGoods_list(List<String> goods_list) {
        this.goods_list = goods_list;
    }

    public String getPortrait() {
        return portrait;
    }

    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.id);
        dest.writeString(this.username);
        dest.writeString(this.account);
        dest.writeString(this.password);
        dest.writeStringList(this.goods_list);
        dest.writeString(this.portrait);
    }

    protected User(Parcel in) {
        this.id = in.readLong();
        this.username = in.readString();
        this.account = in.readString();
        this.password = in.readString();
        this.goods_list = in.createStringArrayList();
        this.portrait = in.readString();
    }

    public static final Creator<User> CREATOR = new Creator<User>() {
        @Override
        public User createFromParcel(Parcel source) {
            return new User(source);
        }

        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };
}
